
public class ButtonArtist extends Component 
{
	public boolean state;
	public String label;
	public Artist artist;
	////////////////////////////////////////////////////////////////////////////////////////////////////

	public ButtonArtist(String string,int x,int y,Artist artist) {
		state = false;
		width =  129;
		height = 25;
		this.label = string;
		this.x=x;
		this.y=y;
		this.artist = artist;
	}

	public void draw()
	{
		GLOBAL.processing.textFont(GLOBAL.plotFont, 14);
		int cx = x;
		int cy = y;
		if(label != null)
		{
			//width = (int)(GLOBAL.processing.textWidth(label)) + 10;
			GLOBAL.processing.textAlign(GLOBAL.processing.LEFT);

			if(state){
				GLOBAL.processing.rectMode(GLOBAL.processing.CORNER);
				GLOBAL.processing.noStroke();
				GLOBAL.processing.fill(120);
				GLOBAL.processing.rect(x, y, width, height);
			}

			if(mouseOver()) 
			{
				super.draw();
				if(GLOBAL.processing.mousePressed)
				{
					GLOBAL.gu.drawBox(x, y, width, height, 0, GLOBAL.processing.color(150, 150, 200), 255);
					GLOBAL.gu.drawBox(x, y, width, height, 1, GLOBAL.processing.color(150, 150, 200), 150);
					cx += 2;
					cy += 2;

				}
				createMouseOver();

			}

			GLOBAL.processing.strokeWeight(1);
			GLOBAL.processing.fill(GLOBAL.textColor);
			if((int)(GLOBAL.processing.textWidth(label))>130){
				GLOBAL.processing.text(label.substring(0, GLOBAL.processing.min(15,label.length()))+"...", cx + 5, cy + 20);
			}
			else GLOBAL.processing.text(label, cx + 5, cy + 20);
		}
	}


	// Draw entire label on mouseOver for too long labels
	public void createMouseOver(){

		int w = (int)(GLOBAL.processing.textWidth(label));
		if(w<=130) return;

		GLOBAL.selectionPanel.xHighLight = x-w-15;
		GLOBAL.selectionPanel.yHighLight = y;
		GLOBAL.selectionPanel.stringHighLight = label;

	}


	public void mouseClicked(){
		state = !state;
	}

	////////////////////////////////////////////////////////////////////////////////////////////////////

}